<?php 
/**
 * ==============================================
 * Copy right 2015-2016 http://wei.meididi88.com
 * ----------------------------------------------
 * This is not a free software, without any authorization is not allowed to use and spread.
 * ==============================================
 * @author: hy
 * @date: 2015-9-10
 * @version: v1.0.0
 */
namespace Home\Model;

use Think\Model;

/**
 * 银行卡Model模型类
 */
class CardModel extends Model{
	  //添加数据验证	  
	    protected  $_validate = array(
	        array('cardHolder','require','持卡人不能为空！'),	       
	        array('card','require','银行卡号不能为空！'),
	    	array('card','19','银行卡号必须是19位数',1,'length')	       
	    );
	    
	    protected $fields = array(
	    	'id',
	    	'cardHolder',
	    	'card',
	    	'bank_name',
	    	'card_type',
	    	'target_id',
	    	'last_four_number',
	    	'status',
	    	'created',
	    	'_pk'=>'id',
	    	'_autoink'=>true	
	    );
	    
	    /**
	     * 获取美容师银行卡列表
	     * 
	     * @param number $beauticianId 美容师编号
	     * @return boolean|array
	     */
	    public function getBeauticianCard($beauticianId) {
	    	return $this->where(array('target_id' => $beauticianId))->select();
	    }
}